<?php include_partial('account_menu',array('active_tab'=>'myproducts'))?>
<div class="account_content">
<div class='righttext'>
<?php echo link_to('Добавить товар','account/addproduct');?>
</div>

<?php if(count($pager))
{ ?>
<br />
<table class='myproduct_table' cellspacing="0">
<tr>
<th width="20">
Id
</th>
<th width="350">
Наименование
</th>
<th width="300">
Категория
</th>
<th width="80">
Цена, грн
</th>
<th width="80">
Цена, $
</th>
<th width="80">
</th>
</tr>
<?php foreach($pager->getResults() as $prod) { ?>

	<tr>
<td width="20">
<?php echo $prod['id'] ?>
</td>
<td width="350">
<?php echo $prod['title'] ?>
</td>
<td width="300">
<?php echo $prod['Category']['title'] ?>
</td>
<td width="80">
<?php echo sprintf('%0.2f', $prod['price']==NULL ? $prod['price_usd']*$course : $prod['price']) ?>
</td>
<td width="80">
<?php echo sprintf('%0.2f', $prod['price_usd']==NULL ? $prod['price']/$course : $prod['price_usd']) ?>
</td>
<td width="15" style='font-size:9px'>
<?php echo link_to('редактировать', 'account/editproduct?prid='.$prod['id'] ).'<br />'.link_to('удалить','account/deleteproduct?prid='.$prod['id']); ?>
</td>
	</tr>
	<?php } ?>
</table>
<div style='text-align:right; margin-top:10px;'>
<?php if($pager->haveToPaginate()){
	// first arrow
	if ($pager->getPage()>1)	
	echo link_to("&larr; ",'account/showmyproducts?page='.($pager->getPage()-1),array('style' => 'text-decoration:none'));
	else echo '&larr; ';
	
for ($i=1; $i<=$pager->getLastPage(); $i++)
{
	echo $i != $pager->getPage() ? link_to("$i ",'account/showmyproducts?page='.$i,array('style' => 'text-decoration:none')) : "$i ";
}
	// last arrow
	if ($pager->getPage()<$pager->getLastPage())	
	echo link_to("&rarr; ",'account/showmyproducts?page='.($pager->getPage()+1),array('style' => 'text-decoration:none'));
	else echo '&rarr;';
?>
<div><?php echo link_to('все','account/showmyproducts?page=all'); ?></div>

</div>
<?php } // if havetopaginate 
else {  ?>
	<div style='text-align:right; margin-top:10px;'><?php echo link_to('постраничный просмотр', 'account/showmyproducts') ?></div>
<?php }

}else{ ?>
<div>
У вас нет добавленных товаров</div>
<?php } ?>
</div>